<!doctype html public "-//w3c//dtd html 4.0 transitional//en" "http://www.w3.org/tr/html4/loose.dtd">
<html>
<head>
<?php
$this->load->view("head");
?>
<script language="javascript" src="<?php echo base_url();?>js/jquery/school.js"></script>
<!--The following scripts and css inclueded are used specifically for register-->
<script src="<?php echo base_url(); ?>js/formValidator/jquery_last.js" type="text/javascript"></script>
<link type="text/css" rel="stylesheet" href="<?php echo base_url(); ?>js/formValidator/style/validator.css" />
<script src="<?php echo base_url(); ?>js/formValidator/formValidator_min.js" type="text/javascript"></script>
<script src="<?php echo base_url(); ?>js/formValidator/formValidatorRegex.js" type="text/javascript"></script>
<script type="text/javascript">
            $(document).ready(function(){
                $.formValidator.initConfig({onError:function(msg){alert(msg)}});
                $("#username").formValidator({tipid:"v_username",onempty:"用户名不能为空",onshow:"请输入用户名, 由字母或数字或下划线组成",onfocus:"用户名长度至少3个字符，最多20个字符"}).InputValidator({min:3,max:20,onerror:"您输入的用户名长度错误"}).RegexValidator({regexp:"^[a-zA-Z0-9_-]{2,19}$",onerror:"用户名只能包含英文和数字"}).AjaxValidator({type:"get",url:"<?php echo site_url();?>/user/is_usable",data:'/'+$("#username").val(),datatype:"html",success:function(msg){if(escape(msg)=="0") {return true;}else{return false;}},error: function(){alert("服务器没有返回数据，可能服务器忙，请重试");},onerror : "该用户名已经被占用，请选择其它的用户名",onwait : "正在对用户名进行合法性校验，请稍候..."});
                $("#passwd").formValidator({tipid:"v_passwd",onshow:"请输入密码",onfocus:"密码不能为空",oncorrect:"密码符合要求"}).InputValidator({min:4,max:25,onerror:"密码至少4位，最多25位"});
                $("#passwd_r").formValidator({tipid:"v_passwd_r",onshow:"请重新输入密码",onfocus:"两次密码必须完全一致",oncorrect:"两次密码一致"}).CompareValidator({desID:"passwd",onerror:"两次输入的密码不一致，请检查您的输入"}).InputValidator({min:4,max:25,onerror:"重新输入的密码长度不正确"});
                $("#email").formValidator({tipid:"v_email",onshow:"请输入E-mail邮箱地址, 例如 shuyi@bookiki.net",onfocus:"邮箱地址长度至少6个字符,最多100个字符",}).InputValidator({min:6,max:100,onerror:"你输入的邮箱长度不正确"}).RegexValidator({regexp:"^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$",onerror:"你输入的邮箱格式不正确"});
                //$("#phone").formValidator({tipid:"v_phone",onshow:"请输入电话号码",onfocus:"号码不超过20位"}).InputValidator({min:0,max:20,onerror:"电话号码长度超过限制"}).RegexValidator({regexp:"^[+0-9_-]+[0-9_-]$",onerror:"你输入的号码格式不正确"});
                //$("#qq").formValidator({tipid:"v_qq",onshow:"请输入QQ号码",onfocus:""}).InputValidator({min:0,max:20,onerror:"号码长度不正确"}).RegexValidator({regexp:"^[0-9]$",onerror:"你输入的QQ号格式不正确"});
            });

            //用户单击“提交”按钮时对用户输入进行验证
            function formCheck(form){
                var status=jQuery.formValidator.PageIsValid();
                if(form.license.checked!=true){
                    alert("请注意:\n您必须同意我们的会员注册协议以及隐私保护政策。");
                    //alert(status);
                    form.username.focus();
                    return false;
                }
                else
                    if(status!=true){
                        return false;
                    }
            }
</script>
</head>
<?php
$this->load->view("headview");
?>


<div class="center_chart">
      <h2>书易新用户注册</h2>
      <form name="change_form" id="change_form" method="post" action="<?=site_url()?>/user/add_new_user">
          <input type="hidden" name="site_url" id="site_url" value="<?=site_url()?>">
             <div class="form_row">
            <label class="contact">用户名:</label>
            <input name="username"  type="text" id="username" class="contact_input" />
            </div><br/>
            <div id="v_username" align="left"></div>

            <div class="form_row">
             <label class="contact">Email:</label>
             <input name="email" type="text" id="email" class="contact_input" />
             </div><br/>
             <div id="v_email" align="left"></div>


              <div class="form_row">
              <label class="contact">密码:</label>
              <input type="password" name="passwd" id="passwd" class="contact_input" />
              </div><br/>
              <div id="v_passwd" align="left"></div>

               <div class="form_row">
               <label class="contact">确认密码:</label>
               <input name="passwd_r" type="password" id="passwd_r" class="contact_input" />
               </div><br />
               <div id="v_passwd_r" align="left"></div>

               <div class="form_row">
                   
                   省：&nbsp;&nbsp;&nbsp;
<select name="province" id="province" style="width:30%" onchange="listcitys(this.value)">
    <option value="0" selected>请选择</option>
<option value="1">北京市</option><option value="2">天津市</option>
<option value="3">河北省</option><option value="4">山西省</option>
<option value="5">内蒙古自治区</option><option value="6">辽宁省</option>
<option value="7">吉林省</option><option value="8">黑龙江省</option>
<option value="9">上海市</option><option value="10">江苏省</option>
<option value="11">浙江省</option><option value="12">安徽省</option>
<option value="13">福建省</option><option value="14">江西省</option>
<option value="15">山东省</option><option value="16">河南省</option>
<option value="17">湖北省</option><option value="18">湖南省</option>
<option value="19">广东省</option><option value="20">广西壮族自治区</option>
<option value="21">海南省</option><option value="22">重庆市</option>
<option value="23">四川省</option><option value="24">贵州省</option>
<option value="25">云南省</option><option value="26">西藏自治区</option>
<option value="27">陕西省</option><option value="28">甘肃省</option>
<option value="29">青海省</option><option value="30">宁夏回族自治区</option>
<option value="31">新疆维吾尔自治区</option><option value="32">香港特别行政区</option>
<option value="33">澳门特别行政区</option><option value="34">台湾省</option>
</select>

&nbsp;&nbsp;市：&nbsp;&nbsp;&nbsp;
<select name="city" id="city" style="width:30%" onchange="listschools(this.value)">
<option value="0" selected>请选择</option>
</select>
               </div>
<p></p>

<div class="form_row">
学校：
<select name="school" style="width:30%" id="school" onchange="listcampuss(this.value)">
    <option value="0">请选择</option>
</select>
&nbsp;&nbsp;校区：
<select name="campus" style="width:30%" id="campus">
<option value="-1">请选择</option>
</select>
</div>

<div class="form_row">
    <p/>
    <p><a href="#" onclick="add_school()">没有找到我的学校>>></a></p>
    <font color="red"><?=$warning?></font>
</div>

                <hr><h3>以下内容选填，联系方式只有注册用户可见。如果希望使用我们B2C服务，请填写实名，手机和寝室地址</h3>

                <div class="form_row">
                <label class="contact">收货人:</label>
                <input name="realname" type="text" id="realname" class="contact_input" />
                 </div><br />
                 <div id="v_realname" align="left"></div>

                <div class="form_row">
                <label class="contact">手机:</label>
                <input name="phone" type="text" id="phone" class="contact_input" />
                 </div><br />
                 <div id="v_phone" align="left"></div>

                 <div class="form_row">
                <label class="contact">虚拟网短号:</label>
                <input name="short_phone" type="text" id="short_phone" class="contact_input" />
                 </div><br />
                 <div id="v_short_phone" align="left"></div>
                 
                 <div class="form_row">
                <label class="contact">寝室地址</label>
                <input name="dorm" type="text" id="dorm" class="contact_input" />
                 </div><br />
                 <div id="v_dorm" align="left"></div>
                 
                <div class="form_row">
                <label class="contact">书店名称</label>
                <input name="shopname" type="text" id="shopname" class="contact_input" />
                 </div><br />
                 <div id="v_bookshop" align="left"></div>
             

                 <div class="form_row">
                 <label class="contact"><strong>QQ:</strong></label>
                 <input name="qq" type="text" id="qq" class="contact_input" />
                 </div><br />
                 <div id="v_qq" align="left"></div>

                  <!--
                  <div class="form_row">
                  <label for="license">
                  <input type="checkbox" id="license" name="license" value="agree" checked="checked"/>
                  本人已阅读、理解并同意本站的 <a href="" target='_blank'><span>会员注册协议</span></a>。</label>
                  </div>-->


                  <div class="form_row">
                  <?php if(isset($error)){?>
                          <font color="red"><?=$error?></font>
                   <?php }?>
                  </div>
                  <div class="form_row">
                  <input  id="submit_button" type="submit" value="提交" onclick="return formCheck(signup_form)"/>
                  </div>
                  <input type="hidden" name="currentpage" value="<?=$currentpage?>"/>
                  <input type="hidden" name="continue" value="<?=$continue?>"/>
          </form>
</div><!-- end of center content --><!-- end of right content -->

<?php
$this->load->view("footer2");
?>
